package com.herui.iot.ui.device;

import androidx.appcompat.app.AppCompatActivity;
import butterknife.OnClick;

import android.Manifest;
import android.os.Bundle;
import android.view.View;

import com.herui.device_lib.presenter.DevicePresenter;
import com.herui.sdyu_lib.base.FragmentDirectionAnim;
import com.herui.sport_care.R;
import com.herui.sport_care.ui.BaseSportActivity;

public class DeviceTestActivity extends BaseSportActivity {

    private DevicePresenter devicePresenter;

    private String[] permissionArray = new String[]{
            Manifest.permission.ACCESS_COARSE_LOCATION,
            Manifest.permission.ACCESS_FINE_LOCATION,
            Manifest.permission.READ_PHONE_STATE
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        devicePresenter = new DevicePresenter();
    }

    @Override
    public int getLayout() {
        return R.layout.activity_device_test;
    }

    @Override
    public void initParam() {
        askMultiplePermission(permissionArray);
    }

    @OnClick({R.id.btn_scan_ecg, R.id.btn_connect_ecg, R.id.btn_scan_bp, R.id.btn_connect_bp,
    R.id.btn_start_bp, R.id.btn_connect_spo, R.id.btn_scan_spo})
    public void onViewClick(View view) {
        switch (view.getId()) {
            case R.id.btn_scan_ecg:
                devicePresenter.scanEcg();
                break;
            case R.id.btn_connect_ecg:
                devicePresenter.connectEcg("EB:F0:91:68:35:71");
                break;
            case R.id.btn_scan_bp:
                devicePresenter.scanBp();
                break;
            case R.id.btn_connect_bp:
                devicePresenter.connectBp("A4:C1:38:52:07:34");
                break;
            case R.id.btn_start_bp:
                devicePresenter.startBp();
                break;
            case R.id.btn_connect_spo:
                devicePresenter.connectSpo("00:A0:50:3E:7E:5A");
                break;
            case R.id.btn_scan_spo:
                devicePresenter.scanSpo();
                break;
            default:
                break;
        }
    }
}